import requests


class IhrmEmpCRUDApi:
    @staticmethod
    def add_emp(token, emp_data):
        return requests.post("http://localhost:8080/api/sys/user",
                             headers={"Content-Type": "application/json", "Authorization": "Bearer " + token},
                             json=emp_data)

    @staticmethod
    def query_emp(uid, token):
        return requests.get("http://localhost:8080/api/sys/user/" + uid,
                            headers={"Authorization": "Bearer " + token})

    @staticmethod
    def modify_emp(uid, token, emp_data):
        return requests.put("http://localhost:8080/api/sys/user/" + uid,
                            headers={"Content-Type": "application/json", "Authorization": "Bearer " + token},
                            json=emp_data)

    @staticmethod
    def delete_emp(uid, token):
        return requests.delete("http://localhost:8080/api/sys/user/" + uid,
                               headers={"Authorization": "Bearer " + token})


